// 公共js
// 底部
$('.mui-footer .change-color').click(function () {
    $(this).addClass('active');
    $(this).siblings().removeClass('active');
})
// 设置主体回弹效果
mui('.mui-scroll-wrapper').scroll({
    scrollY: true, //是否竖向滚动
    scrollX: false, //是否横向滚动
    startX: 0, //初始化时滚动至x
    startY: 0, //初始化时滚动至y
    indicators: true, //是否显示滚动条
    deceleration: 0.0006, //阻尼系数,系数越小滑动越灵敏
    bounce: true //是否启用回弹
});
// 封装ajax请求
var common = {
    getAjax: function (url, data, success) {
        // console.log(localStorage.getItem('token'))
        $.ajax({
            url: url,
            headers: {
                'token': localStorage.getItem('token')
            },
            // dataType: 'jsonp',
            data: data,
            success: function (result) {
                if (typeof data === 'function') {
                    success = data;
                }
                success(result);
            },
            error: function (data) {
                console.log(data)
            }
        });

    },
    postAjax: function (url, data, success) {
        console.log(localStorage.getItem('token'))
        data +='&token='+localStorage.getItem('token');
        console.log(data)
        $.ajax({
            url: url,
           
            type: 'post',
            // dataType: 'jsonp',
            data:data,
            success: function (result) {
                if (typeof data === 'function') {
                    success = data;
                }
                success(result);
            },
            error: function (data) {
                console.log(data)
            }
        });

    }

}